<%@ page language="java" contentType="text/html; charset=utf-8" import="com.hykj.dao.IndexPicDao"
	import="java.util.*"
	import="com.hykj.valuebean.IndexPic"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/hykj/css/header.css" />
<title>管理首页</title>
<script type="text/javascript">
function changeUrl() {
	
	var x = document.getElementsByName("indexpic");
	var url = "";
	var ur = "";
	for (i = 0; i < x.length; i++) {
		if (x[i].checked) {
			url += (x[i].value +",");
		}
		ur = url.substring(0,(url.lastIndexOf(",")));
	}
	document.getElementById("delete").action="/hykj/admin/deleteIndexPic?Id=(" + ur + ")";
	
}

function deleteIndexPic() {
	document.getElementById("delete").submit();
}
</script>

</head>

<body>
<center>
<jsp:include page="/admin/head.jsp">
	<jsp:param name="menu" value="home"></jsp:param>
</jsp:include>
<table width = "600">
<tr>
	<td bgcolor="#323232" align="left"><a href="/hykj/admin/insertIndexPic.jsp">新增</a></td>
	<td bgcolor="#323232" align="right"><input type="button" onclick="deleteIndexPic()" value="删除"></input></td>
</tr>
<tr>
	<td>
	<c:set var="indexPicList" value="${requestScope.indexPicList}" />
	<form id="delete" action="" name="deleteform" method="post">
	<table>
		<c:forEach var="indPic" items="${indexPicList}">
		
			<c:if test="${!empty indPic}">
				<c:if test="${indPic.category == 1 }">
					<tr>
						<td>左侧大图</td>
						<td>
							<input onclick="changeUrl()" type="checkbox" name="indexpic" value=${indPic.id } />
							${indPic.sequ }
							<a href="/hykj/admin/viewIndexPic?id=${indPic.id}" >${indPic.describes }</a>
						</td>
						<td>${indPic.picHref }</td>
					</tr>
				</c:if>
				<c:if test="${indPic.category == 2 }">
					<tr>
						<td>右侧小图</td>
						<td>
							<input onclick="changeUrl()" type="checkbox" name="indexpic" value=${indPic.id } /> 
							<a href="/hykj/admin/viewIndexPic?id=${indPic.id}">${indPic.describes}</a>
						</td>
						<td>${indPic.picHref }</td>
					</tr>
				</c:if>
			</c:if>
			
		</c:forEach>
	</table>
	</form>
	</td>
</tr>
</table>

<jsp:include page = "/admin/foot.jsp" />
</center>
</body>
</html>